//
//  SMyTravelTableViewCell.m
//  News
//
//  Created by dlios on 15-5-15.
//  Copyright (c) 2015年 PEAK. All rights reserved.
//

#import "SMyTravelTableViewCell.h"

@implementation SMyTravelTableViewCell

-(void)dealloc
{
    [_cellImageView release];
    [_cellLabel1 release];
    [_cellLabel2 release];
    [super dealloc];
}

- (void)awakeFromNib {
    // Initialization code
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        
        self.cellImageView = [[UIImageView alloc] init];
//        _cellImageView.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:_cellImageView];
        [_cellImageView release];
        
        self.cellLabel1 = [[UILabel alloc] init] ;
//        _cellLabel1.backgroundColor = [UIColor yellowColor];
//        _cellLabel1.text = @"djksjdijd";
//        _cellLabel1.numberOfLines = 0;
//        _cellLabel1.textAlignment = NSTextAlignmentLeft;
        [self.contentView addSubview:_cellLabel1];
        [_cellLabel1  release];
        
        self.cellLabel2 = [[UILabel alloc] init];
//        _cellLabel2.backgroundColor =[ UIColor cyanColor];
//        _cellLabel2.text = @"Gygyugui";
//        _cellLabel2.textAlignment = NSTextAlignmentLeft;
        [self.contentView addSubview:_cellLabel2];
        [_cellLabel2 release];
   }
    return self;
}

-(void)layoutSubviews
{
    
    [super layoutSubviews];
//    CGFloat f =[[self class]heightWithText:_cellLabel1.text];
    
    _cellImageView.frame = CGRectMake(10, 5, [UIScreen mainScreen].bounds.size.width / 3.41, [UIScreen mainScreen].bounds.size.height / 7.41  );
    _cellLabel1.frame = CGRectMake([UIScreen mainScreen].bounds.size.width / 2.88, 5, [UIScreen mainScreen].bounds.size.width - _cellImageView.bounds.size.width - 20, 30);
    _cellLabel2.frame = CGRectMake([UIScreen mainScreen].bounds.size.width / 2.88, [UIScreen mainScreen].bounds.size.width / 10,[UIScreen mainScreen].bounds.size.width - _cellImageView.bounds.size.width - 20, 60);
    _cellLabel2.font = [UIFont systemFontOfSize:14];
//    [_cellLabel2 setLineBreakMode:NSLineBreakByWordWrapping];
//    _cellLabel2.numberOfLines = 0;
    
    
}
-(void)setSTravelOne:(STravelObject *)STravelOne
{
    if (_STravelOne != STravelOne) {
        [_STravelOne release];
        _STravelOne = [STravelOne retain];
    }
    
    _cellLabel1.text = STravelOne.title;
    _cellLabel2.text = STravelOne.digest;
    [_cellImageView sd_setImageWithURL:[NSURL URLWithString:STravelOne.imgsrc]placeholderImage:[UIImage imageNamed:@"``_3(NZ4U{L@4L7FN0J70DA"]];
     
    
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
